home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
1833
/
1833.xpi
/
chrome
/
yoono.jar
/
content
/
yoono
/
messageinfos.js
< prev
next >
Wrap
Text File
|
2009-12-16
|
2KB
|
66 lines
// Affichage d'un ptit bandeau avec des infos pour les synchros
var messageinfos = {
timer : Components.classes['@mozilla.org/timer;1'].createInstance(Components.interfaces.nsITimer),
delay : 10, // en secondes
message: function (browserparent) {
for (var i = browserparent.childNodes.length; i--> 0 ; ) {
if (browserparent.childNodes[i].nodeName == "yoonomessage")
return browserparent.childNodes[i];
}
return false;
},
showmessage: function (type, text1, text2) {
try {
var browser = getBrowser().selectedBrowser;
var browserParent = browser.parentNode;
var message = this.message(browserParent);
if (!message) {
yoonoGlob.debug('creation message');
message = document.createElement("yoonomessage");
browserParent.insertBefore(message, browser);
}
message.setAttribute('type', type);
message.text1 = text1;
text2 = text2 || '';
message.text2 = text2;
message.autoRandom = YNPREFBRANCH.getBoolPref('autorandom');
browser.isShowingMessage = true;
message.hidden = false;
var event = document.createEvent("Events");
event.initEvent("AlertActive", true, true);
message.dispatchEvent(event);
} catch(e) {
YOONO_LOG.exception(e);
}
},
hidemessage: function () {
var browser = getBrowser().selectedBrowser;
var browserParent = browser.parentNode;
var message = this.message(browserParent);
message.hidden = true;
},
init : function (type, text1, text2) {
try {
this.timer.cancel();
this.showmessage(type, text1, text2);
this.timer.init(this, this.delay * 1000, this.timer.TYPE_ONE_SHOT);
} catch(e) {
YOONO_LOG.exception(e);
}
},
observe : function(subject, topic, data) {
this.hidemessage();
}
}